<!-- 头部 -->
<include file="Common:header" />
<script>
$(function(){
  $("#star_area").change(
	function(){
		$("#star").load("__APP__/Recommon/getAjaxStar/stararea/"+$('#star_area').val());
	});
});
$(function(){
  $("#star_id").change(
	function(){    
		if( $('#star_id').val() == "orther" ){
			$("#new_star_name").css('display','inline');
		}else{
			$("#new_star_name").css('display','none');
		}
	});
});
function focusStr(id,title){
	var content = $(id).val();
	if( content == title ){
		 $(id).val("");
		 $(id).html("");
	}
}
function blurStr(id,title){
	var content = $(id).val();
	if( content == "" ){
		 $(id).val(title);
		 $(id).html("");
	}
}

function submit(){
	var str = document.getElementsByName("price");
	var objarray = str.length;
	var chestr = "";
	for (i=0;i<objarray;i++){
	  if(str[i].checked == true){
	   chestr += str[i].value + ",";
	  }
	}
	if(chestr == ""){
	  alert("请先选择一个价格！");
	  return false;
	}else{
	  document.getElementById("pricearr").value = chestr;
	}

	var str = document.getElementsByName("rule");
	if(str[0].checked != true){
		alert("请选同意推荐规则！");
		return false;
	}

	$("form").submit()
}

function delPhoto(id){
	$.getJSON('__URL__/delPhoto',{id:id},function(json){
			if(json.status==1){
				$('#photo'+id).attr('src',_PUBLIC_+"/Uploads/Photo/default_300.png"); 
			}       
		});
}
</script>
<!-- 我要推荐表单 -->
<div class="white_wrap middle">
	<form id="form" name="form" action="__APP__/Recommon/addRecom" method="post" enctype="multipart/form-data">
    <div class="content_middle recommon">
         <div class="recommon_row">
         	<span>选择明星：</span>
            <select name="star_area" id="star_area"><option value="1">大陆</option><option value="2">港台</option></select>
            <span id="star">
				<select name="star_id" id="star_id">
				<volist name="starinfo" id="vo">
					<option value="{$vo['id']}">{$vo['chinese_name']}</option>
				</volist>
					<option value="orther">其他</option>
				</select>
			</span>
            <input id="new_star_name" name="new_star_name" class="new_star_name def_val" value="请填写明星名" onfocus="focusStr('#new_star_name','请填写明星名');" onblur="blurStr('#new_star_name','请填写明星名');" style="display:none"/>
         </div>
         <div class="recommon_row">
         	<span class="floatleft">上传图片</span>
            <div class="upload_s floatleft"><img class="upload_img" id="photo1" src="__PUBLIC__/Uploads/Photo/default_300.png" /><img src="__PUBLIC__/Images/upload_del.png" class="upload_del" alt="删除" title="删除" onclick="delPhoto(1)" /></div>
			
			<div class="upload_s floatleft"><img class="upload_img" id="photo2" src="__PUBLIC__/Uploads/Photo/default_300.png" /><img src="__PUBLIC__/Images/upload_del.png" class="upload_del" alt="删除" title="删除" onclick="delPhoto(2)" /></div>

			<div class="upload_s floatleft"><img class="upload_img" id="photo3" src="__PUBLIC__/Uploads/Photo/default_300.png" /><img src="__PUBLIC__/Images/upload_del.png" class="upload_del" alt="删除" title="删除" onclick="delPhoto(3)" /></div>
         </div>          
         <div class="recommon_row">
         	<span>图片来源：</span>
            <input name="img_source" value="http://" class="img_source def_val" /><b>请填写图片的来源网址</b>
         </div> 
         <div class="recommon_row">
         	<span>标题描述：</span>
            <input name="title" value="" class="img_source" /><b>例如：图片中T恤好喜欢</b>
         </div> 
         <div class="recommon_row">
         	<span>接受价格：</span>
            <input type="checkbox" name="price" value="100" class="chk" />100以内
            <input type="checkbox" name="price" value="200" class="chk" />100至200
            <input type="checkbox" name="price" value="500" class="chk" />200至500
            <input type="checkbox" name="price" value="501" class="chk" />500以上
         </div> 
         <div class="recommon_row reason">
         	<span>推荐理由：</span>
            <textarea name="reason" id="reason" class="def_val" rows="4" cols="60" onfocus="focusStr('#reason','请填写推荐理由');" onblur="blurStr('#reason','请填写推荐理由');" >请填写推荐理由</textarea>
         </div>
         <div class="recommon_row">
         	<span class="whitehid floatleft">同意规则：</span>
            <input type="checkbox" name="rule" value="1" class="chk" checked="checked" />我同意推荐规则
         </div>
         <div class="recommon_row">
			<input type="hidden" value="" id="pricearr" name="pricearr">
         	<span class="whitehid floatleft">立即推荐：</span>
            <a href="javascript:void(0)" onclick="submit()" class="w80r">立即推荐</a>
         </div>                                                         
    </div>
	</form>
</div>    
<link href="__PUBLIC__/Css/imgareaselect/imgareaselect-default.css" rel="stylesheet" type="text/css" />
<load href="__PUBLIC__/Js/ajaxupload.js" />
<load href="__PUBLIC__/Js/jquery.imgareaselect.js" />
<load href="__PUBLIC__/Js/recommon.js" />

<!-- 页脚 -->
<div id="footer">
	<div class="g_foot">
    <a href="">联系我们</a><a href="">联系我们</a><a href="">联系我们</a><a href="">联系我们</a><a href="">联系我们</a><br />备案号：京ICP证090503号 Copyright © 2012 All rights reserved. 梦创时空（北京）科技有限公司
    </div>
</div>
</body>
</html>
